Device for generating a message authentication code for authenticating a message

ABSTRACT

Device for generating a message authentication code for authenticating a message, wherein the message is divided in blocks (M) with a specified block length, the device comprising a generating unit for generating the message authentication code based on a message by using a block cipher algorithm, and an encrypting unit for performing an exclusive disjunction on the last block with a first key (K 1,  K 2 ) and for performing an exclusive disjunction on the first and/or the last block additionally with a second key (K 3,  K 4 ) for generating the message authentication code.

This application claims the priority of European patent application no.09168875.4, filed on Aug. 27, 2009, the contents of which areincorporated by reference herein.

FIELD OF THE INVENTION

The invention relates to a device for generating a messageauthentication code for authenticating a message. Furthermore, theinvention relates to a system for generating a message authenticationcode for authenticating a message. Moreover, the invention relates to asmart card. Furthermore, the invention relates to a method for agenerating a message authentication code for authenticating a message.Beyond this, the invention relates to a program element. Furthermore,the invention relates to a computer-readable medium.

BACKGROUND OF THE INVENTION

During message transmission, messages may be changed by an attacker. Toavoid such an attack, there exist different approaches. One of theseapproaches is a method for constructing message authentication codes(MACs) using block ciphers and is known as “CMAC”.

The MAC on a message is constructed by splitting it into blocks of sizeequal to the blocksize of the underlying cipher (e.g. 128 bits in thecase of AES), CBC-encrypting the message (with padding in the last blockif required), and retaining (all or part of) the result of the lastblock encryption as the computed MAC value. In the event that a MACshorter than the cipher blocksize is to be used, the computed MAC may betruncated by retaining the required number of most significant bits. AMAC algorithm, sometimes called a keyed (cryptographic) hash function,accepts as input a secret key and an arbitrary-length message to beauthenticated, and outputs a MAC (sometimes known as a tag). The MACvalue protects both a message's data integrity as well as itsauthenticity, by allowing verifiers (who also possess the secret key) todetect any changes to the message content.

Differential power analysis is a form of side channel attack in whichthe attacker studies the power consumption of a cryptographic hardwaredevice (such as a smart card, tamper-resistant “black box”, orintegrated circuit). The attack can non-invasively extract cryptographickeys and other secret information from the device. To prevent certaincryptographic attacks, some MAC construction algorithms may re-encryptthe last block of the message with a further key. Nevertheless, such anencrypted message authentication code remains vulnerable to DPA attackssince the first-block-input and last-block-output vectors are stillvisible.

SUMMARY OF THE INVENTION

Hence, it is an object of the invention to provide a device providing amore secure authentication of a message.

The object of the invention is achieved by a device, a system, a smartcard, a method, a program element and a computer-readable mediumaccording to the independent claims.

According to an exemplary embodiment, a device for generating a messageauthentication code for authenticating a message is provided, whereinthe message is divided in blocks with a specified block length, whereinthe device comprises a generating unit for generating the messageauthentication code based on a message by using a block cipheralgorithm, and an encrypting unit for performing an exclusivedisjunction on the last block with a first key and for performing anexclusive disjunction on the first and/or the last block additionallywith a second key for generating the message authentication code.

According to another exemplary embodiment, a system for generating amessage authentication code for authenticating a message is provided,wherein the message is divided in blocks with a specified block length,wherein the system comprises a sender and a receiver, wherein the senderand the receiver comprise a device with the above mentioned features,respectively.

According to still another exemplary embodiment, a smart card isprovided, wherein the smart card comprises a device with the abovementioned features.

According to still another exemplary embodiment, a method for generatinga message authentication code for authenticating a message is provided,wherein the message is divided in blocks with a specified block length,the method comprising generating the message authentication code basedon a message by using a block cipher algorithm, performing an exclusivedisjunction on the last block with a first key, and performing anexclusive disjunction on the first and/or the last block additionallywith a second key for generating the message authentication code.

According to still another exemplary embodiment of the invention, aprogram element (for instance a software routine, in source code or inexecutable code, for instance a downloadable program) is provided,which, when being executed by a processor, is adapted to control orcarry out a method having the above mentioned features.

According to yet another exemplary embodiment of the invention, acomputer-readable medium (for instance a CD, a DVD, a USB stick, afloppy disk or a harddisk) is provided, in which a computer program isstored which, when being executed by a processor, is adapted to controlor carry out a method having the above mentioned features.

Data processing which may be performed according to embodiments of theinvention can be realized by a computer program, that is by software, orby using one or more special electronic optimization circuits, that isin hardware, or in hybrid form, that is by means of software componentsand hardware components.

The term “block cipher algorithm” may denote an algorithm using a blockcipher. A block cipher is a symmetric key cipher operating onfixed-length groups of bits, termed blocks, with an unvaryingtransformation. A block cipher encryption algorithm might take (forexample) a 128-bit block of plaintext as input, and output acorresponding 128-bit block of ciphertext.

The generating unit and the encrypting unit may be formed as a singleunit and/or on a single chip.

The term “exclusive disjunction” may denote also an exclusive-ORing orXOR-function on the different blocks. The encrypting unit may performwith one or more additional keys an XORing of these keys with therelevant data vector, and the linearity of this XOR step may provide aprotection against DPA.

The first key may also be a pair of keys, wherein only one of the pairof keys may be used respectively.

The message authentication code may be used for authenticating a messagesent from a sender to a receiver. The sender may generate the messageauthentication code based on the message and the first and the secondkey and send this code together with the message to the receiver. Thereceiver may receive the message together with the code and generate acode based on the message and the first and the second key itself.Subsequently, the receiver may compare the received messageauthentication code with the self-generated message authentication codeand authenticate in this way the received message.

The term “sender” may denote a transponder or any similar device and theterm “receiver” may denote for example a communication partner for theresponder.

The term “smart card” may denote also a chip card or integrated circuitcard.

In the following, further exemplary embodiments of the device will beexplained. However, these embodiments also apply to the system, to thesmart card, to the method, to the program element and to thecomputer-readable medium.

According to an exemplary embodiment, the block cipher algorithm may bea message authentication code algorithm. In cryptography, a messageauthentication code (often MAC) is a short piece of information used toauthenticate a message. A MAC algorithm, sometimes called a keyed(cryptographic) hash function, accepts as input a secret key and anarbitrary-length message to be authenticated, and outputs a MAC(sometimes known as a tag). The MAC value protects both a message's dataintegrity as well as its authenticity, by allowing verifiers (who alsopossess the secret key) to detect any changes to the message content.

MACs differ from digital signatures, as MAC values are both generatedand verified using the same secret key. This implies that the sender andreceiver of a message must agree on keys before initiatingcommunications, as is the case with symmetric encryption.

According to a further exemplary embodiment, the encrypting unit may beadapted for using a first second key for the first block and a secondsecond key for the last block. The first and second second keys may alsobe called first additional key and second additional key. Thus, it maybe more difficult for an attacker to gain any information for both keys.

According to a further exemplary embodiment, the second key may dependon the first key. Either or both of the second keys, that means thefirst and the second second key may depend on the first key. Thus, thesecond key may be any computable function of the first key. In general,a function is an abstract entity that associates an input, here thefirst key, to a corresponding output, here the second key, according tosome rule.

According to a further exemplary embodiment, the second key mayexchangeable between the device and a communication partner. The devicemay be a transponder and the communication partner may be acorresponding receiver. In this case, the second key may be known to thedevice and to the communication partner prior to the generation of themessage authentication code.

Embodiments of the invention are related to transponders, in particularsmart cards and RFID tags. For the sake of clarity, this descriptionmakes reference primarily to smart cards, although for one skilled inthe art it is clear that embodiments of the invention equally relate toRFID tags and transponders in general, as well as to devices in generalwhich communicate over a wired or wireless connection.

These and other aspects of the invention are apparent from and will beelucidated with reference to the embodiments described hereinafter.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention will be described in greater detail hereinafter, by way ofnon-limiting examples, with reference to the embodiments shown in thedrawings.

FIG. 1 shows a principle of a method according to an exemplaryembodiment of the invention.

FIG. 2 shows a principle of the method according to a further exemplaryembodiment of the invention.

FIG. 3 shows a principle of the method according to a further exemplaryembodiment of the invention.

FIG. 4 shows a principle of a common method for generating a methodauthentication code.

FIGS. 5 a and 5 b shows an attack without and with using a method ordevice according to an exemplary embodiment of the invention.

DESCRIPTION OF EMBODIMENTS

The illustration in the drawing is schematically. In different drawings,similar or identical elements are provided with the same referencesigns.

The NIST (National Institute of Standards and Technology) recommend amethod for construction of message authentication codes (MACs) using ablock cipher known as cipher-based MAC (CMAC).

The MAC on a message is constructed by splitting it into blocks of sizeequal to the blocksize of the underlying cipher (e.g. 128 bits in thecase of Advanced Encryption Standard (AES)), CBC (cipher blockchaining)-encrypting the message (with padding in the last block ifrequired), and retaining (all or part of) the result of the last blockencryption as the computed MAC value. In the event that a MAC shorterthan the cipher blocksize is to be used, the standard dictates that thecomputed MAC should be truncated by retaining the required number ofmost significant bits.

FIG. 4 shows the principles of MAC construction according to thisstandard. Special attention should be paid to the operations of “subkeyinsertion” on the last block. The subkeys K1 or K2 are secret constants,derived from the encryption of a constant vector under the MAC key inuse, which are additionally XORed with the input to the final blockoperation. The objective of making the last block operation differentfrom all others is to prevent simple “MAC-chaining” attacks which becomepossible in the absence of “special last blocks”. In general, withoutthis “special last block” function, using this principle, an attackercan concatenate in an arbitrary fashion suitably modified MAC'd messageshe has previously seen computed under the same MAC key, for examplewithin a communication session. With this measure, since derivation ofthe subkey requires knowledge of the MAC key, an attacker is no longerable to chain messages when only the last block operation includes thisconstant which is unknown to him.

Differential Power Analysis (DPA) attacks operate by testing ahypothesis about (part of) a cryptographic key; such a hypothesis istested by correlating power trace measurements of a device when usingthe key being attacked against its expected internal signals under theassumption that the hypothesis is correct. With the correct hypothesis,large increases in computed correlation can be observed compared to thecases where the hypothesis is incorrect. Typically, such attacks requirea large number of power traces (of the order of 10⁶, although the exactnumber is implementation-dependent).

In order to perform DPA attacks, the attacker needs to be able toconvert his hypothesis about part of the key into some expectation aboutthe internal signal he is correlating against the power trace. Usually,in the case of a block cipher operating in encrypt-mode, this means thathe needs to know either the input data vector, whereupon he can performan encryption operation which depends on the part of the key about whichhe has a hypothesis; this is typically the action of a first-roundsubstitution (or S-box) on a combination of key and input data, or theoutput data, whereby he can perform the equivalent of a decryptionoperation by working backwards through the last round to derive anexpected internal signal.

Note that it is not necessary for the attacker to have access to bothinput and output for such an attack, which makes the application of DPAvery general and powerful. A complete DPA attack to recover a key isusually a multi-stage process; the attacker gathers a large number ofpower traces with known input or output data as described above. Thesesame traces are used a number of times to test hypotheses aboutdifferent parts of the cipher key in use, enabling the attacker toderive all or most of the key bits. In practice, he usually recovers the“round key” for the first or last round, from which he can derive thelogical key from a knowledge of the scheduling/expansion algorithm.

In the specific case of AES, an attacker would typically test hypothesesone byte at a time, corresponding to the action of data and a round keybyte on one of the S-box instances. Once he has recovered 16 round keybytes, the logical key in use is easily derived, since the AES keyexpansion can be computed either forwards or backwards.

In general, the same principles can apply whether DPA is used to performa key recovery attack on encryption, decryption, or MACcomputation/verification. In the case of an encryption operation, it isusually the output ciphertext that is available to an attacker, whilst aMAC computation is often performed on known message data, that means theinput is available.

Thus, for MAC on known message data, the input to the first blockoperation is wholly known; the inputs to subsequent blocks are not knowndue to the block chaining The output of only the last block is known(unless the MAC is truncated, in which case the last block output isonly partly known), since it is the MAC result itself. In the case of asingle-block MAC, the block operation can be thought of as a “finalblock”; a subkey is used, so the input to the block operation is notknown, in this case because of the effect of the XORing of a CMAC subkeyvalue not known to an attacker.

According to a first exemplary embodiment, a principle of generating aMAC is shown in FIG. 1, which prevents DPA-attacks on the visiblefirst-block-input vector. The presence of a subkey, which may be a valuesimilar to K1/K2 as specified by CMAC, but next to this also acompletely independent shared secret of block length size can possiblybe used, obscures the data vector required by an attacker to mount a DPAattack. In the method shown in FIG. 1, a subkey value K3 is added byXORing it with the input to the first block operation.

An alternative mechanism which can be used to protect the visiblefirst-block-input against DPA attacks is to limit the possible values ofthe M1 message block to a small number of possibilities. When thevisible first block vector can only take a small number of values, thisnumber acts as an upper bound on the number of different traces theattacker is able to collect in order to mount his DPA attack. If thisnumber is already below the threshold of DPA attack resistance which agiven implementation provides, then such an attack cannot besuccessfully mounted.

The same approach as used in FIG. 1 may be used to protect the visibleoutput from the last block operation as shown in FIG. 2. In this case,it is important to protect the entire output vector, so the insertion ofthe subkey is performed directly on the output of the final blockoperation, before the truncation operator (which of course may be“null”). In FIG. 2, the additional subkey K4 insertion is shown. As aresult of the subkey insertion, the output vector from the last subkeyoperation is not visible to an attacker.

Also a combination of the principles shown in FIGS. 1 and 2 may beprovided as shown in FIG. 3. Here, the first subkey K3 is inserted intothe method for the first block and also the second subkey K4 is insertedinto the method for the last block.

In the case of a MAC on a single-block message, the presence of one ofthe standard subkeys K1/K2 is sufficient to protect the input vector; inthis case, one would not need to use the subkey K3.

The presence of the subkey K3 or K4 acts as a mask which prevents theattacker from deriving correct logical key information from his DPAattack. To understand this more clearly, consider FIGS. 5 a and 5 b.

In FIG. 5 a, the part of the input vector which affects the input to anS-box (substitution box) in the first round is denoted by M, and Kj isthe portion of the first round key which affects that S-box; formultiple inputs M, the attacker makes a hypothesis about the value of Kjand tests for confirmation of that hypothesis using the above decribedprocess. The DPA attack is typically mounted at the output of the S-box,shown with a X. The subscript “j” here denotes only that Kj is a portionof the roundkey (called the “j-portion” hereafter); when AES is theblock cipher used, it really is a specific byte of the (first round)key; however, for other block ciphers e.g. as in the case of DES, theportion of key involved may not consist of contiguous bits.

Note that the bitsize of Kj must be sufficiently small that the attackercan test all possible hypotheses about its possible value in areasonable time; for example, with the AES cipher, each first roundS-box is affected by 8 bits of round key so there are 256 hypotheses totest.

In FIG. 5 b, the configuration in the presence of a subkey is shown. Thesubkey KX may be a function of K (f(K)) or a specified secret value.What the attacker can recover by a DPA attack is the value which is theexclusive-OR of KX and Kj; however, this does not unambiguously revealthe subkey. In the case, that the subkey is a function of K,the“j-portion” of the key K is not unambigously revealed, since thej-portion of f(K) i.e. [f(K)]j depends on the whole key (at least whenthe function f( )is the conventional one used to create subkeys i.e.encryption of a constant vector under the key K). The attacker cannotmake and test an independent hypothesis about only the j-portion of Ksince his test is affected by all other portions at the same time (atleast in the case where f( ) has the properties of a well-behavedblock-cipher).

In general, the “subkey” can of course be any secret value known only tothe creator and verifier of the MAC, which is not necessarily derivedfrom the MAC key; in this case, it acts as an XOR mask acting on theinitial round key portion.

The MAC constructions described herein are designed to protect input andoutput vectors for the purposes of resisting key recovery attacks usingDPA.

Finally, it should be noted that the above-mentioned embodimentsillustrate rather than limit the invention, and that those skilled inthe art will be capable of designing many alternative embodimentswithout departing from the scope of the invention as defined by theappended claims. In the claims, any reference signs placed inparentheses shall not be construed as limiting the claims. The word“comprising” and “comprises”, and the like, does not exclude thepresence of elements or steps other than those listed in any claim orthe specification as a whole. The singular reference of an element doesnot exclude the plural reference of such elements and vice-versa. In adevice claim enumerating several means, several of these means may beembodied by one and the same item of software or hardware. The mere factthat certain measures are recited in mutually different dependent claimsdoes not indicate that a combination of these measures cannot be used toadvantage.

1. Device for generating a message authentication code forauthenticating a message, wherein the message is divided in blocks witha specified block length, the device comprising a generating unit forgenerating the message authentication code based on a message by using ablock cipher algorithm, and an encrypting unit for performing anexclusive disjunction on the last block with a first key and forperforming an exclusive disjunction on the first and/or the last blockadditionally with a second key for generating the message authenticationcode.
 2. Device according to claim 1, wherein the block cipher algorithmis a message authentication code algorithm.
 3. Device according to claim1, wherein the encrypting unit is adapted for using a first second keyfor the first block and a second second key for the last block. 4.Device according to claim 1, wherein the second key depends on the firstkey.
 5. Device according to claim 1, wherein the second key isexchangeable between the device and a communication partner.
 6. Systemfor authenticating a message, wherein the message is divided in blockswith a specified block length, the system comprising a sender and areceiver, wherein the sender and the receiver comprise a deviceaccording to claim 1, respectively.
 7. Smart card comprising a deviceaccording to claim
 1. 8. Method for generating a message authenticationcode for authenticating a message, wherein the message is divided inblocks with a specified block length, the method comprising generatingthe message authentication code based on a message by using a blockcipher algorithm, performing an exclusive disjunction on the last blockwith a first key, and performing an exclusive disjunction on the firstand/or the last block additionally with a second key for generating themessage authentication code.
 9. A computer-readable medium, in which acomputer program is stored, which computer program, when being executedby a processor, is adapted to carry out or control a method according toclaim 8
 10. A program element, which program element, when beingexecuted by a processor, is adapted to carry out or control a methodaccording to claim 8.